package com.mx.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

import com.netflix.appinfo.HealthCheckHandler;
import com.netflix.appinfo.InstanceInfo.InstanceStatus;

/**
 * @author mengbin
 * @date 2018年7月7日 下午2:50:30
 */
@Component
public class MyHealthCheckHandler implements HealthCheckHandler {

    @Autowired
    private MyHealthIndicator indicator;
    
    @Override
    public InstanceStatus getStatus(InstanceStatus insts) {
        Status status = indicator.health().getStatus();
        return Status.UP.equals(status) ? insts.UP : insts.DOWN;
    }

}
